*************************************************************************************************
**********Replication for "The Issues are the Issues: Intangible Salience and War Duration"******
*************************************************************************************************
*************************************************************************************************




*******To replicate the analysis, tables, and figures you will need to use the following pacages. 


********to make the figures, you will need to install the blindschems pacakge
ssc install blindschemes, replace all


********Then set the scheme to plottig

set scheme plottig

******* Use the dataset entitled issuesareissue_main

clear 

use "issuesareissues_main.dta"



********Table 1, Summary Statistics


su normintan deminit  terrain contig relcap nstates majpowboth durscale  pctturnf 

**********************************************************
**********Analysis with cox models***************************
*********************************************************


************stset the data so it is ready  for survival analysis
stset warday, id(id) f(endday)


******Analysis found in Table 2 of the main document

*********model 1 
stcox normintan, robust 


********Model 2

stcox normintan deminit terrain relcap durscale, robust
********Proportional hazards test for model 2 (found in table 4 of Appendix K)*********** 
estat phtest, detail


******Model 3 
stcox normintan deminit terrain relcap durscale majpowboth nstates contig pctturnf, robust


********Proportional hazards test for model 3 (found in table 5 of Appendix K)*********** 
estat phtest, detail




*******To make the survival curves in Figure 4, run the follwing code:
stcurve, surv  at1(normintan=.368) at2(normintan=1.186) at3(normintan=1.499) at4(normintan=1.954) at6(normintan=2.661) ///
 title("")ytitle("Probibility of Survival") xtitle("Days") ///
 legend(label(1 "Intangible Salience=0.368") label(2 "Intangible Salience=1.186") label(3 "Intangible Salience=1.499") ///
 label(4 "Intangible Salience=1.954") label(5 "Intangible Salience=2.661"))

 
 
*******************************************************************************
 ************Figures 1, 2, and 3***********************************************
 ******************************************************************************
 
 
 
 
 
 *******To repliate figure 1 use this data
 clear
 use "cowdurat.dta"

*******to make the figure, run this code

hist durat, frequency bin(40) xtitle("Days")


*********To replicate figure figure 2, use this data:

clear
use "frequency.dta"

****to make the figure, run this code
graph dot freq, over(id) ytitle("Frequency of Issues")

*****to replicate figure 3, use this data: 
clear 
use "intangiblesal.dta"

****to replicate the figure, use this code


graph dot intan, over(id) ytitle("Intangible Salience of Issues")







*********Appendix Models**************

***stset the data
stset, clear
stset warday, id(id) f(endday)





****To replicate the correlation matrix:


corr normintan deminit terrain relcap durscale majpowboth nstates contig pctturnf


*******To replicate Appendix H Table 2

stcox normintan deminit terrain relcap durscale majpowboth nstates contig pctturnf totsal, robust



******To replicate Appendix I Table 3

stcox normintan deminit terrain relcap durscale majpowboth nstates contig pctturnf pa10lag, robust


*******Extended Cox Proportional Hazards Model Appendix K Table 6

stcox normintan deminit terrain relcap durscale majpowboth nstates contig pctturnf, tvc(relcap nstates) robust


